import datetime

from celery import Celery

broker = 'redis://:123456@127.0.0.1:6379/1'
backend = 'redis://:123456@127.0.0.1:6379/2'

app = Celery('celery_task',
             broker=broker, 
             backend=backend, 
             include=[
                 'mycelery.celery_task.task_one',
                 'mycelery.celery_task.task_two',
                 'mycelery.celery_task.task_three'
             ])

# 配置时区
app.conf.timezone = 'Asia/Shanghai'
app.conf.enable_utc = False

# 定时任务
app.conf.beat_schedule = {
    "low-task": {
        "task": "send_three",
        "schedule": datetime.timedelta(seconds=10),
        "args": (),
    }
}